package cn.gson.springboot.model.service;




import cn.gson.springboot.model.dao.ComplainDao;
import cn.gson.springboot.model.dao.MaintenanceDao;
import cn.gson.springboot.model.mapper.ComplainMapper;
import cn.gson.springboot.model.mapper.MaintenanceMapper;
import cn.gson.springboot.model.pojos.Complain;
import cn.gson.springboot.model.pojos.Maintenance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class MaintenanceService {
    @Autowired
    MaintenanceDao maintenanceDao;
    @Autowired
    MaintenanceMapper maintenanceMapper;

    //新增
    public void addMaintenance(Maintenance maintenance){
        maintenanceDao.save(maintenance);//一次保存一个对象
    }

    //删除
    public void deleteOne(int maiId){
        maintenanceDao.deleteById(maiId);
    }

    //查找所有
    public List<Maintenance> selectAll(String search,Integer type){
        return (List<Maintenance>)maintenanceMapper.selectAll(search, type);
    }

    public List<Maintenance> selectMaintenanceCus(Integer cusId){
        return maintenanceMapper.selectMaintenanceCus(cusId);
    }

    public Maintenance selectOne(Integer maiId) {
        return maintenanceMapper.selectOne(maiId);
    }

    public int selectA() {
        return maintenanceMapper.selectA();
    }
    public List<Maintenance> selectA2() {
        return maintenanceMapper.selectA2();
    }
    public int selectB() {
        return maintenanceMapper.selectB();
    }
    public List<Maintenance> selectB2() {
        return maintenanceMapper.selectB2();
    }
    public int selectC() {
        return maintenanceMapper.selectC();
    }
    public List<Maintenance> selectC2() {
        return maintenanceMapper.selectC2();
    }
    public int selectD() {
        return maintenanceMapper.selectD();
    }
    public List<Maintenance> selectD2() {
        return maintenanceMapper.selectD2();
    }
    public int selectE() {
        return maintenanceMapper.selectE();
    }
    public List<Maintenance> selectE2() {
        return maintenanceMapper.selectE2();
    }
    public int selectF() {
        return maintenanceMapper.selectF();
    }
    public List<Maintenance> selectF2() {
        return maintenanceMapper.selectF2();
    }
    public int selectG() {
        return maintenanceMapper.selectG();
    }
    public List<Maintenance> selectG2() {
        return maintenanceMapper.selectG2();
    }
}
